{{!
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*     http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
}}

<div class="panel panel-default panel-capacity">
  <div class="panel-heading">
  <div class="panel-title">
    <strong>Capacity</strong>
    <a href="#" {{action 'toggleEdit'}} class="text-right"> 
      {{#if view.isEdit}}
        <div class="edit-link">Hide Edit</div>
      {{else}}
        <div class="edit-link">Show Edit</div>
      {{/if}}
    </a>
  </div>
  </div>
  <div class="panel-body total">
<div class="control-label queue-label">TOTAL</div>
{{capacity-bar capacityValue=totalCapacity maxCapacityValue=totalCapacity warn=leafQueues.firstObject.overCapacity}}
  </div>
  <div class="panel-body queues">
    {{#each leafQueues}}
      <div {{bind-attr class=":queue-capacity this.isCurrent:active"}}>
        <p>
          <div class="control-label queue-label">{{this.name}}</div>
        </p>
        {{capacity-bar capacityValue=this.capacity maxCapacityValue=this.maximum_capacity warn=this.overCapacity}}
        {{render "capacityEditForm" this}}
      </div>
    {{/each}}
    {{#each newLeafQueues}}
      <div {{bind-attr class=":queue-capacity :new-queue this.isCurrent:active"}} >
        <div class="input-row row" >
          <div class="col-md-5">
            {{#each this.errors.path}}
              <p class="help-block red">{{this.message}}</p>
            {{/each}}
          </div>
        </div>
        {{capacity-bar capacityValue=this.capacity maxCapacityValue=this.maximum_capacity warn=this.overCapacity}}
        {{render "capacityEditForm" this}}
      </div>
    {{/each}}
  </div>
</div>
